<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page import="net.tribal.comic.entities.Page" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <title><g:message code="title.page.create.nav"/></title>
    </head>
    <body>
		<div class="navButtonsTop rounded-corners">
			<h1 class="title"><g:message code="title.page.create" args="[comic.title]"/></h1>
	    </div>
		    
		<g:uploadForm action="save">
       		<div class="element">
	       		<g:hasErrors bean="${pageInstance}">
		    		<div class="errors rounded-corners"><g:renderErrors bean="${pageInstance}" as="list" /></div>
		   		</g:hasErrors>
		   		
           		<div class="tableCreate">
            		<table>
                		<tbody>
                      		<tr>
		                        <td class="name">
        		                    <label for="title"><g:message code="default.label.title"/>:</label>
                		        </td>
                        		<td colspan="5" class="value requiredField ${hasErrors(bean: pageInstance, field: 'title', 'errors')}">
                            		<g:textField class="focus" name="title" size="50px" maxlength="50" value="${fieldValue(bean: pageInstance, field: 'title')}" />
                        		</td>
                    		</tr>
                    		<tr>
                                <td class="name">
                                    <label for="numberPage"><g:message code="default.label.numberPage"/>:</label>
                                </td>
                                
                                
                                <td colspan="5" class="value ${hasErrors(bean: pageInstance, field: 'numberPage', 'errors')}">
                                
                                	<input type="button" id="specifyPage" value="${message(code:'specify.page.label')}"/>
									<input type="hidden" id="specifyPageShowed" value="false"/>
                                	<span id="specifyPageWrapper" class="hidden">
	                                    <p>excepto las siguientes paginas que ya estan en uso:</p>
										<g:textField name="customNumberPage" value="${params.customNumberPage}" valueMessagePrefix="default"/>
	                                    <g:select name="suggestedNumberPage" from="${pageInstance.suggestedPages}" value="${params.suggestedNumberPage}" valueMessagePrefix="default"/>
                                    </span>
                                </td>
                            </tr>
                    		<tr>
                    			<td  class="name">
									<label><g:message code="default.label.path"/>:</label></td>
								<td colspan="5" class="value ${hasErrors(bean: pageInstance, field: 'path', 'errors')}">
									<input type="file" name="file"/>
								</td>
                    		</tr>
							<tr>
							    <td colspan="6" class="value ${hasErrors(bean: pageInstance, field: 'description', 'errors')}">
							        <richui:richTextEditor name="description" value="${pageInstance?.description}" width="600"/>
							    </td>
							</tr>
							<tr>
							    <td class="name">
							    	<usr:isAdmin>
							        	<label for="disabled"><g:message code="default.label.disabled"/>:</label>
							        </usr:isAdmin>
							    </td>
							    <td class="value ${hasErrors(bean: pageInstance, field: 'disabled', 'errors')}">
							    	<usr:isAdmin>
							        	<g:checkBox name="disabled" value="${pageInstance?.disabled}" />
							        </usr:isAdmin>
							    </td>
							    <td class="name">
							        <label for="commentable"><g:message code="default.label.commentable"/>:</label>
							    </td>
							    <td class="value ${hasErrors(bean: pageInstance, field: 'commentable', 'errors')}">
							        <g:checkBox name="commentable" value="${pageInstance?.commentable}" />
							    </td>
							    <td class="name">
						        <label for="rateable"><g:message code="default.label.rateable"/>:</label>
							    </td>
							    <td class="value ${hasErrors(bean: pageInstance, field: 'rateable', 'errors')}">
							        <g:checkBox name="rateable" value="${pageInstance?.rateable}" />
						       </td>
						   </tr>
						</tbody>
		            </table>
        		</div>    
        		</div>
        		
				<div class="navButtons rounded-corners">
					<div class="left">		
	             		<g:submitButton name="create" class="save" value="${message(code:'default.button.create')}" />
	             	</div>
	             	<div class="right">
						<g:link class="back" controller="comic" action="show" id="${pageInstance?.comic?.id}"><g:message code="default.button.back"/></g:link>
	 	        	</div>
 	        	</div>
		 		<g:hiddenField name="comic.id" value="${pageInstance?.comic?.id}" />
			</g:uploadForm>
		
    </body>
</html>
